package com.camel.docker.controller;


import com.baomidou.mybatisplus.service.IService;
import com.camel.core.controller.BaseCommonController;
import com.camel.core.entity.Result;
import com.camel.core.utils.ResultUtil;
import com.camel.docker.entity.Repository;
import com.camel.docker.service.ContainerCreatorService;
import com.camel.docker.service.ContainerService;
import com.camel.docker.service.RepositoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author baily
 * @since 2020-10-16
 */
@RestController
@RequestMapping("/repository")
public class RepositoryController extends BaseCommonController {
    @Autowired
    private RepositoryService service;

    @Autowired
    private ContainerCreatorService containerCreatorService;

    @Autowired
    private ContainerService containerService;

    @PostMapping
    public Result save(@RequestBody Repository repository) {
        return super.save(repository);
    }

    @GetMapping
    public Result index(Repository repository) {
        return ResultUtil.success(service.selectPage(repository));
    }

    @GetMapping("/{id}")
    public Result detail(@PathVariable Integer id) {
        return super.details(id);
    }

    @PutMapping
    public Result update(@RequestBody Repository repository) {
        return super.update(repository);
    }

    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Integer id) {
        return super.delete(id);
    }

    @Override
    public IService getiService() {
        return service;
    }

    @Override
    public String getMouduleName() {
        return "仓库";
    }
}

